# Contributor: Anjandev Momi <anjan@momi.ca>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=comics-downloader
pkgver=0.33.8
pkgrel=2
pkgdesc="Tool to download comics and manga in pdf/epub/cbr/cbz from a website"
url="https://github.com/Girbons/comics-downloader"
license="MIT"
arch="all"
# tests download stuff from random website and compare to predefined values
options="chmod-clean !check"
makedepends="go mesa-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev"
subpackages="$pkgname-gui:gui"
source="$pkgver-$pkgname.tar.gz::https://github.com/Girbons/comics-downloader/archive/refs/tags/v$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -o build/comics-downloader ./cmd/downloader
	go build -o build/comics-downloader-gui ./cmd/gui
}

check() {
	go test ./...
}

package() {
	install -Dm755 "$builddir"/build/comics-downloader \
		"$pkgdir"/usr/bin/comics-downloader-linux
}

gui() {
	install -Dm755 "$builddir"/build/comics-downloader-gui \
		"$subpkgdir"/usr/bin/comics-downloader-linux-gui
}

sha512sums="
0556444babdb8fbbce01ca661272ecedea3e4c8c5fcfe8d505368bb64a41c58c3c3cef5688c3823fcde078f7954d0754d955ea74356f20adcf7e6f45fc73f06d  0.33.8-comics-downloader.tar.gz
"
